/*
 construct a feature_lib class
 check if the power are within the limitation
 double check if the feature are in the library
 written by He Dongjing, Shanghai Jiao Tong University
*/
#ifndef __CHECK_H__
#define __CHECK_H__

#include <stdlib.h>

#define CHK_SIZE 8
#define LIB_SIZE 1000
#define CHK_POW_UP 1.5
#define CHK_POW_LOW 0.5

struct feature_ele {
	int location;
	double power;
	char *block_name;
};

double get_power(const struct feature_ele ele);
int get_location(const struct feature_ele ele);
void set_power(struct feature_ele *ele, double pow);
void set_location(struct feature_ele *ele, int loc);
bool check_power(const struct feature_ele input, double orig_pow);

class feature_lib {
private:
	int size;
	struct feature_ele *points;
public:
	feature_lib();
	feature_lib(int s);
	//~feature_lib();
	int get_size() {return size;};
	feature_ele get_index_ele(int index) {return points[index];};
	int get_index_location(int index) {return points[index].location;};
	void print_ele();
	bool add_ele(struct feature_ele ele);
	double double_check(const struct feature_ele ele);
};

void get_lib_from_file(char *file_name, feature_lib *lib);
void set_lib_to_file(char *file_name, feature_lib lib);

#endif
